<template>
  <div>
    <!-- debug区域 -->
    <!-- <div style="border: 5px solid #000000">
      <span>storeId:</span>
      <el-input style="width: 150px" v-model="storeId"></el-input>
      <el-button type="primary" @click="debug1()">跳到商家页面</el-button>
      <el-button type="primary" @click="debug2()">跳转</el-button>
    </div> -->

    <!-- 实际窗口 -->
    <div id="app">
      <div v-show="noFound != true">
        <Store ref="store" @storeNoFound="storeNoFound" />
      </div>

      <div v-show="noFound == true">
        <div style="height: 100px;"></div>
        <h1 style="font-size: 40px; " align="center">找不到店铺</h1>
      </div>
    </div>
  </div>
</template>

<script>
import Store from "@/components/Store";

export default {
  name: "App",
  data() {
    return {
      noFound: false,
    };
  },
  components: {
    Store,
  },
  methods: {
    // debug1() {
    //   window.open("http://localhost:8080/#/?storeId=" + this.storeId);
    // },
    // debug2() {
    //   var url =
    //     "http://localhost:8080/#/?storeId=2&oriAddress=" +
    //     "http://localhost:88/userfront/store.html/#/?storeId=1";

    //   window.open(url);
    // },
    storeNoFound() {
      this.noFound = true;
      document.title = "找不到店铺";
    },
  },
  created() {
    console.log(process.env);
  },
  mounted() {
    // console.log(this.$route.query.storeId);
    var storeId;

    if (this.$route.query.storeId != null) storeId = this.$route.query.storeId;
    else storeId = -1;

    this.$refs.store.init(storeId);
  },
};
</script>

<style scoped>
/* #app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
} */
</style>
